Subject: Re: Removing Task started with CreateNewProc
From: [email-masked] (Olaf Seibert)
Date: Tue, 12 Apr 1994 12:47:56 GMT
Newsgroups: comp.sys.amiga.programmer

In <[email-masked]> [email-masked] (Robert Knop) writes:
>I have a parent process that creates a child process with the dos.library
>CreateNewProc, using the NP_Entry tag (as opposed to the NP_SegList tag).
>When I want to finish the task, the parent process sends a message to the
>child process, telling it to clean up.  The child process cleans up
>_everything_ it has allocated, and then does:
>
>ReplyMsg(msg);
>Wait(0L);
>
>When the parent process gets the reply to the "clean up" message, it takes
>that to mean that the child process is cleaned up and ready to be killed, so
>it calls RemTask(childprocess).

First, I would add a Forbid() before the ReplyMsg(), so that the parent
can't possibly see the reply before the child has terminated.

Second, since it is a DOS *Process*, you can't just call RemTask() on it.
The best way is to have it fall of the edge of the world, in this
case, to let it return from the function you initially started.
It will do the cleanup as is judged necessary by the CreateNewProc()
function.
This also works for Tasks, by the way. In practice, there is rarely
need to RemTask() another Task.

>-Rob Knop
-Olaf.
--
___ Olaf 'Rhialto' Seibert                                 [email-masked]
\X/ An original idea. That can't be too hard. The library must be full of them.